package util

import (
	"github.com/go-martini/martini"
	"strconv"
)

func ParamaterToInt16(params martini.Params, paramsName string) (int16,error) {
	i,err := paramaterToInt(params,paramsName)
	 result := int16(i)
	 return result,err;
}

func ParamaterToInt32(params martini.Params, paramsName string) (int32,error) {
	i,err := paramaterToInt(params,paramsName)
	result := int32(i)
	return result,err;
}

func ParamaterToInt64(params martini.Params, paramsName string) (int64,error)  {
	i,err := paramaterToInt(params,paramsName)
	result := int64(i)
	return result,err;
}

func paramaterToInt(params martini.Params,paramsName string)(int64,error){
	paramateStr := params[paramsName]
	i,err := strconv.ParseInt(paramateStr,10,64)
	return i,err
}